<%@ page language="java" %>

<%@ page import="com.scalar.chiptrack.commons.Constants"%>

<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/jsp/finance/finance.jsp"/>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR>
<SCRIPT language="JavaScript">


function editPurchaseOrder()
{
    if( typeof document.openPurchaseOrderForm.cancel != "undefined" )
    {
        document.openPurchaseOrderForm.cancel.disabled=false;
    }
	document.openPurchaseOrderForm.action = '<%=chipTracContext%>/openPurchaseOrder.do?action=edit';
	document.openPurchaseOrderForm.submit();
}

function confrimPurchaseOrder()
{
    if( typeof document.openPurchaseOrderForm.cancel != "undefined" )
    {
        document.openPurchaseOrderForm.cancel.disabled=false;
    }
	document.openPurchaseOrderForm.action = '<%=chipTracContext%>/openPurchaseOrder.do?action=save';
	document.openPurchaseOrderForm.submit();
}

function openReasonCodes()
{
	newWindow = window.open('<%=chipTracContext%>/reasonCodes.do?action=Show','reasonCodesPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,top=0,left=0,height=300,widht=500,resizable=yes');
	newWindow.focus();
}

function openRelatedPOsScreen( purchaseOrder_Id )
{
	newWindow = window.open('<%=chipTracContext%>/openPurchaseOrder.do?action=relatedPOS&purchaseOrder_id='+purchaseOrder_Id,'relatedPOsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=580,height=300,resizable=no');
	newWindow.moveTo(220,180);
	newWindow.focus();
}

function openAuditTrail( purchaseOrder_Id, poNumber )
{
	newWindow=window.open('<%=chipTracContext%>/openPurchaseOrder.do?action=auditTrail&purchaseOrder_id='+purchaseOrder_Id+'&poNumber='+poNumber,'auditTrailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=600,height=700,left=100,top=50,resizable=yes');
	newWindow.moveTo(100,50);
	newWindow.focus();
}

function showPoForViewPrint( purchaseOrderId)
{
    var poViewURL = '<%=chipTracContext%>/openPurchaseOrder.do?action=printerFriendly&purchaseOrderId='+ purchaseOrderId;
    newWindow = window.open (poViewURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
    newWindow.focus();
}
</SCRIPT>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<!-- Top Header Start-->
<%@include file="/jsp/includes/header.jsp"  %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
	<%@include file="/jsp/finance/purchase_order_menu.jsp" %>
</TD>
<!-- end of the side navigations -->

<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<!-- SiteMap Tag --><%--
<chiptrack:sitemap styleClass="NArialS"/>--%>

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<html:form method="post" name="openPurchaseOrderForm" action="/openPurchaseOrder" type="com.scalar.chiptrack.finance.openpo.forms.OpenPurchaseOrderForm">
<center><span class="NArialW">Open Purchase Order</span></center>
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
<TABLE width='90%' align='center' border='0' bordercolor='red'>
<tr><td width="25%"></td><td width="25%"></td><td width="25%"></td><td width="25%"></td></tr>
	<html:hidden name="openPurchaseOrderForm" property="financeHold"/>
	<html:hidden name="openPurchaseOrderForm" property="operationsHold"/>
	<%
		String action = request.getParameter( "action" );
		if( action != null && Constants.ACTION_CONFIRM.equalsIgnoreCase( action ) )
		{
	%>
	<tr>
		<td colspan="2">&nbsp;</td>
		<td colspan="2" id="imagesIndex">
			<a href="javascript:editPurchaseOrder();" class="leftsection" onmouseover="window.status='';return true" onmouseout="window.status='';return true">
			<img border="0" src="<%=chipTracContext%>/jsp/includes/images/edit.gif" title="" ></a>
			<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width='50' height='10'>
			<a href="javascript:confrimPurchaseOrder();" class="leftsection" onmouseover="window.status='';return true" onmouseout="window.status='';return true">
			<img border="0" src="<%=chipTracContext%>/jsp/includes/images/confirm.gif" title="" ></a>
		</td>
	</tr>
	<%
		}
	%>
    <%
		if( action != null && Constants.ACTION_VIEW.equalsIgnoreCase( action ) )
		{
	%>
    <tr>
        <td colspan='4' align="right"><font CLASS="NArialL">Click here to <a href='javascript:showPoForViewPrint(<bean:write name="openPurchaseOrderForm" property="purchaseOrder_id"/> );' onmouseover="window.status='Click here to View/print purchase order';return true" onmouseout="window.status='';return true"> view/print </a>Purchase Order Details</font>
        </td>
    </tr>
     <tr>
        <td colspan='4' align="right">&nbsp;</td>
    </tr>
    <%
		}
	%>
	<tr>
		<td><font class='NArialL'>Vendor Name :</font></td>
		<td class='bodytext'><bean:write name="openPurchaseOrderForm" property="vendorName"/></td>
		<td><font class='NArialL'>PO Type :</font></td>
		<td><font class='bodytext'><bean:write name="openPurchaseOrderForm" property="POTypeString"/></td>
	</tr>
	<tr>
		<td><font class='NArialL'>PO Number :</font></td>
		<td><font class='bodytext'><bean:write name="openPurchaseOrderForm" property="poNumber"/></font></td>
		<td><font class='NArialL'>PO Date :</font></td>
		<td><font class='bodytext'><bean:write name="openPurchaseOrderForm" property="poDate"/></td>
	</tr>
	<tr>
		<td><font class='NArialL'>PO Max $ :</font></td>
		<td class='bodytext'><bean:write name="openPurchaseOrderForm" property="poMaxAmt"/></td>
		<td><font class='NArialL'>Vendor Quote No. :</font></td>
		<td class='bodytext'><bean:write name="openPurchaseOrderForm" property="vendorQuoteNumber"/></td>

	</tr>
	<tr>
		<td><font class='NArialL'>Valid From :</font></td>
		<td class='bodytext'><bean:write name='openPurchaseOrderForm' property="validFromDate"/></td>
		<td><font class='NArialL'>Valid To :</font></td>
		<td class='bodytext'><bean:write name='openPurchaseOrderForm' property="validToDate"/></td>
	</tr>
	<logic:notEqual name="openPurchaseOrderForm" property="purchaseOrder_id" value="-1" >
	<tr>
		<td><font class='NArialL'>PO Rev :</font></td>
		<td><font class='bodytext'><bean:write name="openPurchaseOrderForm" property="poRev" /></font></td>
		<td><font class='NArialL'>PO Last Modified date :</font></td>
		<td><font class='bodytext'><bean:write name="openPurchaseOrderForm" property="poLastModifiedDate"/></font></td>
	</tr>
	<tr>
		<td><font class='NArialL'>Issued PO $ :</font></td>
		<td><font class='bodytext'><bean:write name="openPurchaseOrderForm" property="poIssuedAmt"/></font></td>
		<td><font class='NArialL'>Remaining PO $ :</font></td>
		<td><font class='bodytext'><bean:write name="openPurchaseOrderForm" property="poRemainingAmt"/></font></td>
	</tr>
	</logic:notEqual>
	<tr>
		<td><font class='NArialL'>Holds :</font></td>
		<td colspan='2'><font class='NArialL'>Fin :</font>
		<font class='bodytext'><bean:write name="openPurchaseOrderForm" property="financeHoldAsString"/></font>
		&nbsp;<font class='NArialL'>Ops :</font>
		<font class='bodytext'><bean:write name="openPurchaseOrderForm" property="operationsHoldAsString"/></font>
		<%
			if( action != null && Constants.ACTION_VIEW.equalsIgnoreCase( action ) )
			{
		%>

		<td class='NArialL' align='right'>&nbsp;</td>

		<%
			}
			else
			{
		%>
			<td>&nbsp;</td>
		<%
			}
		%>

	</tr>
    <logic:notEqual name="openPurchaseOrderForm" property="purchaseOrder_id" value="-1">
	<tr><td colspan='4' height=10></td></tr>
    <tr><td><font class='NArialL'>Cancel :</font></td>
    <td><font class='bodytext'><html:checkbox name="openPurchaseOrderForm" property="cancel" disabled='true'/></td>
    <td colspan='2'>&nbsp;</td>
    </tr>
    </logic:notEqual>
    <tr>
        <td>
            <font class='NArialL'><bean:message key="label.sales.salesOrder.ShippingMethod" />:</font>
        </td>
        <td>
            <nested:equal value="-2" property="shippingMethodId">
                <font class='bodytext'><nested:write property="newShippingMethod"/>&nbsp;&nbsp;&nbsp;#&nbsp;&nbsp;&nbsp;<nested:write property="newShippingAccount"/></font>
            </nested:equal>
            <nested:notEqual value="-2" property="shippingMethodId">
                <font class='bodytext'><nested:write property="shipMethod"/>
            </nested:notEqual>
        </td>
        <td>
            <font class='NArialL'>Pay Terms :</font>
        </td>
        <td>
            <nested:equal value="-2" property="payTerms">
                <font class='bodytext'><nested:write property="newPayTerms"/></font>
            </nested:equal>
            <nested:notEqual value="-2" property="payTerms">
                <font class='bodytext'><nested:write property="payTerms"/>
            </nested:notEqual>
        </td>
    </tr>
    <tr><td colspan='4' height=10></td></tr>
	<tr>
		<td><font class='NArialL'>Bill To Address :</font></td>
		<td class='bodytext'><bean:write name="openPurchaseOrderForm" property="billingAddressAsStringForHTMLWithBreaks" filter='false'/></td>
		<td><font class='NArialL'>Ship To Address :</font></td>
		<td class='bodytext'><bean:write name="openPurchaseOrderForm" property="shippingAddressAsStringForHTMLWithBreaks" filter='false'/></td>
	</tr>
	<%
		if( action != null && Constants.ACTION_VIEW.equalsIgnoreCase( action ) )
		{
	%>
	<tr><td colspan='4' height=10></td></tr>
	<tr>
		<td colspan='2' class="NArialL"> <a HREF="javascript:openAuditTrail(<bean:write name="openPurchaseOrderForm" property="purchaseOrder_id"/>, '<bean:write name="openPurchaseOrderForm" property="poNumber"/>' );" onmouseover="window.status='Click to Audit Trail';return true" onmouseout="window.status='';return true" >Audit Trail</a>
		</td>
		<td colspan='2' class="NArialL" align='right'> <%--<a HREF="javascript:openRelatedPOsScreen(<bean:write name="openPurchaseOrderForm" property="purchaseOrder_id"/>);" onmouseover="window.status='Click to Audit Trail';return true" onmouseout="window.status='';return true" >POs generated against this Open PO</a>--%>
		</td>
	</tr>
	<tr><td colspan='4' height=10></td></tr>
	<%
		}
	%>

	<tr><td colspan='4' height=10></td></tr>
	<tr>
		<td><font class='NArialL'>Comments :</font></td>
		<td colspan="2" class='bodytext'><bean:write name="openPurchaseOrderForm" property="comments"/></td>
		<td>&nbsp;</td>
	</tr>
	<tr><td colspan='4' height=10></td></tr>
	<tr><td colspan='4' height=10></td></tr>
</table>
</html:form>
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->
<%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</BODY>
</HTML>

